#include <bits/stdc++.h>
using namespace std;
#define xh(i,a,b) for(int i = a; i < b; ++i)
#define xxh(i,a,b) for(int i = a - 1;i >= b;--i)
#define ll long long

const int N = 1010, M = 100010, MOD = 1e9 + 7;

int n;
ll barriers[N];
ll ans[N] = {0};
vector<int>approximates[M];
int dist[N][N]={0};
int visit[M];

void solve(){
  ans[0] = 1;
  xh(i,1,n){
    xh(j,0,i){
      ans[i] += ans[j]*dist[j][i];
      ans[i] %= MOD;
    }
  }
  cout<<ans[n-1]<<endl;
}

int main(){
  for(int i = 1; i < M; ++i)
      for(int j = i + i; j < M; j += i)
          approximates[j].push_back(i);

  cin>>n;
  xh(i,0,n){
    scanf("%lld",&barriers[i]);
  }
  xh(i,0,n){
    memset(visit, 0, sizeof visit);
    xh(j,i + 1,n){
      int index = barriers[j] - barriers[i];
      for(int k: approximates[index])
          if(visit[k] == 0){
              dist[i][j]++;
              visit[k] = 1;
          }
      visit[index] = 1;
    }
  }
  solve();
  return 0;
}
